package com.bawei.test.banner

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.viewpager.widget.ViewPager
import androidx.viewpager2.widget.ViewPager2
import com.bawei.test.R
import com.youth.banner.Banner
import com.youth.banner.indicator.CircleIndicator
import com.youth.banner.transformer.RotateDownPageTransformer


class BannerActivity : AppCompatActivity() {
    private lateinit var banner: Banner<String,CustomBannerAdapter>
    private var list:MutableList<String>  = mutableListOf()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_banner)



        banner = findViewById(R.id.banner)
        list.add("http://img.kaiyanapp.com/57472e13fd2b6c9655c8a600597daf4d.png?imageMogr2/quality/60/format/jpg")
        list.add("http://img.kaiyanapp.com/afa27b9c52d2ed2f5f8b5f8c12992fcf.png?imageMogr2/quality/60/format/jpg")
        list.add("http://img.kaiyanapp.com/57472e13fd2b6c9655c8a600597daf4d.png?imageMogr2/quality/60/format/jpg")
        list.add("http://img.kaiyanapp.com/afa27b9c52d2ed2f5f8b5f8c12992fcf.png?imageMogr2/quality/60/format/jpg")

        banner.addBannerLifecycleObserver(this)//添加生命周期观察者
            .setAdapter(CustomBannerAdapter(list))
//            .setPageTransformer(RotateDownPageTransformer())//动画
//            .setBannerRound(200f)//圆角弧度
            .setBannerGalleryEffect(50,2,0.8f)//画廊效果
            .setIndicator(CircleIndicator(this))
    }
}